<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/static/styles/test.css">
    <title> 待办事项清单</title>
    <style>
        .is-complete{
            text-decoration: line-through;
        }
    </style>
</head>
<body>
<form action="/todo/save" method="post">
    <div>
        <label for="content">内容：</label>
        <input type="text" id="content" name="content" placeholder="请输入待办事项内容" required/>
        <input type="submit" value="新建">
    </div>
</form>
    <table>
        <tr>
            <th>编号</th>
            <th>内容</th>
            <th>是否完成</th>
            <th>操作</th>
        </tr>
        <#list todoList as todo>
            <tr>
                <td>${todo.id}</td>
                <td <#if (todo.complete)>class="is-complete"</#if>> ${(todo.content)!""}</td>
                <td><input type="checkbox" ${todo.complete?string('checked','')} onclick="checkTodo(${todo.id})"></td>
                <td><a href="/todo/edit?id=${todo.id}">编辑</a>
                    <a href="/todo/delete?id=${todo.id}">删除</a>
                </td>
            </tr>
        </#list>
    </table>
</body>
<script>
    function checkTodo(id){
        window.location.href='/todo/check?id='+id;
    }
</script>
</html>